import React from 'react'

export default function UseRef() {
    let input = React.useRef()
    let box = React.useRef()
    let fn = () => {
        let value = input.current.value
        
        if(value==''){
            alert("请输入内容")
   
        }else{
            box.current.innerHTML = value
            input.current.value = null
        }
      

    }
    return (
        <>
            <input ref={input} type="text" name="" id="" className='in' />
            <button className='button' onClick={fn} >点我提交吧</button>
            <div ref={box} className='box'></div>
        </>
    )
}
